﻿@model CubicFWNet.Data.Models.SendCar
@{
    var operationName = ViewBag.OperationName;
    var operationTime = ViewBag.OperationTime;
}
<section class="content-header">
    <h1>
        添加运输
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index", "Home")">首页</a></li>
        <li class="active"><a href="@Url.Action("AddSendCard", "Purchase")">添加运输</a></li>
    </ol>
</section>
<section class="content">
    <div class="box box-solid">
        <!-- /.box-header -->
        <div class="box-body">
            <div class="row">
                <form class="form-horizontal" id="frmedit" action="@Url.Action("InsertSendCard", "Purchase")" method="post">
                    <div class="box-body">
                        <div class="form-group col-md-6">
                            <label class="col-sm-3 control-label">客户名称</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="TakeCompany" name="TakeCompany" value="" required />
                            </div>
                        </div>
                        <div class="form-group col-md-6">
                            <label class="col-sm-3 control-label">单号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="Number" name="Number" value="" required/>
                            </div>
                        </div>
                        <div class="form-group col-md-6">
                            <label class="col-sm-3 control-label">日期</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control Timedatepicker" id="CreateTime" name="CreateTime" value="" required>
                            </div>
                        </div>
                        <div class="form-group col-md-6">
                            <label class="col-sm-3 control-label">货物总值</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control okeydown" id="Worth" name="Worth" value=""/>
                            </div>
                        </div>
                        <div class="form-group col-md-12" style="height: 1px;"></div>
                        <div class="form-group col-md-6">
                            <label class="col-sm-3 control-label">送货要求</label>
                            <div class="col-sm-9">
                                <textarea class="form-control" rows="3" placeholder="请输入 ..." name="Demand" id="Demand"></textarea>
                            </div>
                        </div>
                        <div class="form-group col-md-12" style="height: 1px;"></div>
                        <div class="form-group col-md-6">
                            <label for="operationName" class="col-sm-3 control-label">操作人</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="operationName" name="operationName" value="@operationName" readonly="readonly">
                            </div>
                        </div>
                        <div class="form-group col-md-6">
                            <label for="operationTime" class="col-sm-3 control-label">日期</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" id="operationTime" name="operationTime" value="@operationTime" readonly="readonly">
                            </div>
                        </div>
                    </div>
                    <div class="box-footer" style="width: 80%; margin-left: 20px;">
                        <a role="button" href="javascript:void(0)" class="btn btn-primary submitbtn" onclick="formsubmit(1)">添加</a>
                        @*<span id="historyBack" class="btn btn-primary submitbtn">返回</span>*@
                        @*<a role="button" href="@Url.Action("PurchaseQuery", "PurchasePerson")" class=" btn btn-primary submitbtn">返回</a>*@
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<div id="loadingPage" style="display: none;">
    <div class="loading-shade"></div>
    <div class="loading-content" onclick="$.loading(false)">数据加载中，请稍后…</div>
</div>

<style>
    .has-error {
        border-color: #dd4b39;
        box-shadow: none;
    }
</style>


@section Scripts{
    <script type="text/javascript">
        //日期控件
        $(".Timedatepicker").datepicker({
            autoclose: true,
            language: 'zh', //汉化
            format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
            minView: "month" //选择日期后，不会再跳转去选择时分秒
        });

        $(document).ready(function () {
            $("#frmedit").validate({
                submitHandler: function (form) {
                    var postData = $(form).formSerialize();
                    $.submitForm({
                        url: $(form).attr("action"),
                        param: postData,
                        success: function () {
                            $.modalAlert("操作成功", "success");
                            window.location.href = '@Url.Action("AddSendCard", "Purchase")';
                        }
                    });
                }
            });
        });

        function formsubmit(t) {
            $("#frmedit").submit();
        }

        $(".okeydown").on("keyup", function () {
            var value = $(this).val();
            if (isNaN(value) || value == "" || value == "Infinity" || value == "NaN") {
                $(this).addClass("has-error");
            } else {
                $(this).removeClass("has-error");
            }
        });


        $(".okeydown").on("keydown", function () {
            var k = event.keyCode;
            if ((k <= 57 && k >= 48) || (k <= 105 && k >= 96) || (k == 8) || (k == 110) || (k == 190)) {
                return true;
            } else {
                return false;
            }
        });

        $("#historyBack").click(function () {
            window.history.go(-1);  //返回上一页
            //window.history.back();  //返回上一页
        });
    </script>
}

